<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<title>聊天</title>
		<meta name="format-detection" content="telephone=no" />
		<link rel="stylesheet" type="text/css" href="../../css/aui.css" />
		<link rel="stylesheet" type="text/css" href="../../css/style.css" />
		<link rel="stylesheet" type="text/css" href="../../css/api.css"/>
		<style>
			body {
			}
		</style>
	</head>
	<body>
		<header class="aui-bar aui-bar-nav aui-border-b">
			<div class="aui-pull-left aui-iconfont aui-icon-left icon-left-coler" tapmode onclick="closeWin()"></div>
			<div class="aui-title">聊天</div>
		</header>
	</body>
	<script type="text/javascript" src="../../script/api.js"></script>
	<script type="text/javascript" src="../../script/common.js" ></script>
	<script type="text/javascript" src="../../script/zepto.min.js"></script>
	<script type="text/javascript" src="../../script/jquery-1.11.3.js"></script>
	<script type="text/javascript">
		apiready = function() {
			api.parseTapmode();

			//change statusbar style
			// api.setStatusBarStyle({
   //                style : 'light'
   //          });
			// api.addEventListener({
			// 	name:'viewdisappear'
			// }, function(ret, err){        
			// 	api.setStatusBarStyle({
			// 		style : 'dark'
			// 	});
			// });

			
			userId = api.pageParam.targetUserId;
			// portraitUri = 'http://img1.360buyimg.com/pop/jfs/t3139/59/4944835986/18414/f3dd2c7c/585cd59cN8736ad36.jpg';
			portraitUri = api.pageParam.targetUserAvatar;
			$('.aui-title').text(api.pageParam.targetUsername);

			var header = $api.dom('header');
			$api.fixIos7Bar(header);
			var header_h = $api.offset(header).h;
			var body = $api.dom('body');
			var body_h = $api.offset(body).h;
			var rect_h = body_h - header_h;
			api.openFrame({
				name : 'chat_frm',
				url : 'chat_frm.html',
				pageParam : {
					key : userId,
					key1 : portraitUri,
					key2 : api.pageParam.targetUsername,
					key3 : api.pageParam.isCompany,
					key4 : api.pageParam.itemid
				},
				rect : {
					x : 0,
					y : header_h,
					w : 'auto',
					h : rect_h - 45
				},
				bounces : true,
				vScrollBarEnabled : false,
				hScrollBarEnabled : false
			});
			api.addEventListener({
				name : 'keyback'
			}, function(ret, err) {
				api.closeWin();
			});
		}

		// $(document).ready(function(){
		// 	$('.aui-title').text(api.pageParam.targetUsername);
		// })
	</script>
</html>
